package net.eascn.babyClone.business
{
	import com.adobe.cairngorm.business.ServiceLocator;
	
	import flash.net.URLVariables;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	import mx.rpc.http.HTTPService;
	
	import net.eascn.babyClone.model.ModelLocator;
	
	[Bindable]
	public class SaveAlbumInstanceDelegate
	{
		private var responder : IResponder;
		
		private var service:Object;
		
		private var model:ModelLocator = ModelLocator.getInstance();
		
		public function SaveAlbumInstanceDelegate( respondeer:IResponder)
		{
			this.service = ServiceLocator.getInstance().getHTTPService('Save');
			this.responder = respondeer;
		}
		
		public function save():void
		{	
			var urlvars:URLVariables = new URLVariables();
			urlvars['action'] = 'new-order';
			urlvars['xmldata'] = model.currentAlbumXML.toString();
			urlvars['orderfrom'] = 'flash';
			var async:AsyncToken = HTTPService(service).send(urlvars);
			async.addResponder(responder);
		}

	}
}